In a communication system, to be mounted on a car, which is conventionally adopted, electronic control units (Electronic Control Unit: ECU) controlling the operation of equipment mounted on the car are connected to each other with buses for a multiple communication, and the buses are connected to each other via a relay connection unit (gateway apparatus) so that the relay connection unit relays messages to be sent and received among the ECUs belonging to different buses.
In recent years, as cars have come to have high function and performance, the number of electrical equipments mounted on cars and that of the ECUs controlling operations of the electrical equipment have rapidly increased, and the number of messages sent and received has increased. Therefore when the relay connection unit receives a large number of messages, a problem that it takes time to execute relay processing occurs.
Therefore various methods to be carried out by the relay connection unit in relaying messages from one ECU to other ECUs within a predetermined period of time have been proposed.
For example, in Japanese Patent Application Laid-Open No. 2007-36907 (patent document 1), there is disclosed the construction in which received messages are stored by the buffer part, the transmission order is rearranged based on the priority set for each message, and the stay period of time of the message inside the relay connection unit is detected. A message having a higher priority is sent earlier than a message having a lower priority. Even in the case in which the transmission of a message having the lowest priority has not finished when the predetermined stay period of time has elapsed, the transmission order is fixed till the transmission of the message having the lowest priority finishes.
This construction allows the message having the higher priority to be sent early and the message having the lower priority to be sent within a certain period of time. Further with received messages being stored by one buffer part, the transmission order is rearranged. Thus it is unnecessary to provide the relay connection unit with a plurality of buffer parts.
A relay connection unit having the buffer part provided for each priority has been proposed. Each time a message is received, the priority thereof is found, and received messages are sorted and stored by each buffer part. The relay connection unit first sends a message stored by the buffer part which stores a message having a high priority. Thereby it is possible to prevent the transmission of an important message from being delayed.
In the patent document 1, based on the priority set for each message, the transmission order of all messages stored by the buffer part is rearranged. In deciding the priority based on the ID of each message, when the relay connection unit newly receives a message, the ID of the newly received message is sequentially compared with the ID of each of all messages stored by the buffer part to rearrange the transmission order of the messages.
For example, let it be supposed that the smaller is the ID of a message, the higher is the priority thereof. When the relay connection unit newly receives the message having ID=412 in a state in which the buffer part stores five messages having ID=412, 300, 100, 002, and 200 respectively, to rearrange six messages in order of the ID, it is necessary to execute comparison operations five times to sequentially compare the ID of the newly received message with the ID of each of all messages stored by the buffer part.
Comparison is made five times in the above-described example. But when a large number of messages stay in the buffer part of the relay connection unit, more time is required to rearrange messages. Thus a problem occurs that it takes much time for the relay connection unit to execute relay processing.
In the relay connection unit having the buffer part provided for each priority, it is necessary to provide the relay connection unit with a plurality of buffer parts, which causes a problem that a large memory capacity is necessary.
For example, let it be supposed that the relay connection unit which allows 100 messages to stay therein within a unit time period is designed. In this case, when the number of the buffer parts is one, a memory capacity capable of storing 100 messages suffices. But when the relay connection unit has a buffer memory storing messages having a higher priority and a buffer memory storing messages having a lower priority, it is necessary to assume a worst value such as a case in which 100 messages having only the high priority stay in the buffer part or a case in which 100 messages having only the low priority stay therein. Therefore a memory capacity capable of storing 200 messages is necessary.
Patent document 1: Japanese Patent Application Laid-Open No. 2007-36907